
//
//  AlertSuccessView.m
//  sellHouse
//
//  Created by 李 佳伟 on 2018/12/5.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "AlertSuccessView.h"
#import "JTCSM.h"
static AlertSuccessView *single=nil;

@interface AlertSuccessView ()

@property (nonatomic,strong) NSTimer *timer;

@end

@implementation AlertSuccessView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

+ (AlertSuccessView *)shareSingle
{
    @synchronized(self){
        if(single == nil){
            single =[ [AlertSuccessView alloc] init];
        }
        
    }
    return single;
}
- (instancetype)init{
    self = [super init];
    if (self) {
        self.frame = CGRectMake(0, 0, KSCREENWidth, KSCREENHeight);
        self.hidden = YES;
        self.userInteractionEnabled = YES;
        self.backgroundColor = RGBACOLOR(0, 0, 0, 0);
        CGRect rect = [df labelHeightWithContent:@"修改成功" width:1000 font:16];
       UILabel * titleLabel = [UILabel initWithFrame:CGRectMake((KSCREENWidth-(rect.size.width+20 ))/2, (KSCREENHeight-(rect.size.height+10))/2,rect.size.width+20 , rect.size.height+10) text:@"修改成功" font:16 textAlignment:NSTextAlignmentCenter texcolor:[UIColor whiteColor] backgroundColor:RGBACOLOR(0, 0, 0, 0.5)];
        [df layerWithView:titleLabel radius:4 width:0 color:nil];
        [self addSubview:titleLabel];
       
    }
    return self;
}

- (void)show{
    self.hidden = NO;
   self.timer  =[NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(hidden) userInfo:nil repeats:YES];
    [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];
   
}
-(void)hidden{
    self.hidden = YES;
    [self.timer invalidate];
}
@end
